class Budget {
    Float expectedTotalIncome = 0.0
    Float knownTotalIncome = 0.0
    Float knownVariableCost = 0.0
    Integer year = 2009

    static belongsTo = Project
    static hasMany = [variableCosts: VariableCost]
    
    static constraints = {
    }

    public Float calcTotalIncome(){
        return (expectedTotalIncome + knownTotalIncome);
    }
    public Float calcTotalVariableCost(){
        // @Richard : Need to modify this method
        Float sum =0.0
        for(VariableCost cost : variableCosts)
        {
            sum+=cost.amount
        }
        return sum
    }
    public Float calcTotalFixedCost(){
        return 1.0
    }
    public Float calcBalance(){

        return calcTotalIncome() - calcTotalVariableCost() -calcTotalFixedCost()
    }
    public Float calcIncomeLastYear(){
        return 1.0
    }
    public Float calcCostLastYear(){
        return 1.0
    }
    public Float calcBalanceLastYear(){
        return 1.0
    }

    public Float calcExpectedVariableCost(){
        // @Richard : Here get the variable cost instance, and iterate over all the category
        // to get the expected variable cost. The known part is just an attribute of this class
        // (who comes from the billing system)
        return 1.0;
    }
}
